package string;

import java.util.Scanner;

public class MatchesDemo {
    public static void main(String[] args) {
//        [a-zA-Z0-9_]+@[a-zA-Z0-9]+(\.[a-zA-Z]+)+
//        String email="wangkj@tedu.cn";
        Scanner scan=new Scanner(System.in);

        String regex="[a-zA-Z0-9_]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)+";

        while (true){
            String email=scan.next();
            boolean match=email.matches(regex);
            if (match){
                System.out.println("请输入密码...");
                break;
            }else {
                System.out.println("请重新输入邮箱...");
            }
        }
    }
}
